package com.rover.crm.service;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.grid.DataGrid;
import com.grid.Page;
import com.rover.crm.entity.Customers;
import com.rover.system.service.BaseService;

/**
 * 客户Service
 */

@Service
@Transactional
public class CustomersService extends BaseService {
    protected Logger logger = LoggerFactory.getLogger(getClass());

 
    @Transactional
    public DataGrid query(Page page) throws Exception {
        DataGrid dataGrid = new DataGrid();
        List<Customers> li = dao.<Customers>findPageHql(page.getHQL(), page.getWhereParams(), page.getPageNo(),
                page.getPageSize());
       
        page.setWhere("category=1  and  createdById=" + this.getActiveUser().getId());
        dataGrid.setResult(li);
        dataGrid.setTotalCount(dao.countHql(page.getHQLTotalCount(), page.getWhereParams()));
        return dataGrid;
    }

}
